<template>
  <div class="step1">
    <p>{{ $t("reserve.selectGame") }}</p>
    <div class="game-list">
      <div class="game-item" v-for="item in gameData" :key="item.goods_id">
        <div class="title">{{ item.goods_name }}</div>
        <img :src="item.goods_img" alt="" />
        <div class="desc" v-html="item.goods_content"></div>
        <div class="btn" @click="next(item)">{{ $t("reserve.select") }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { gameList } from "../reserve.service";
import { ref } from "vue";
const emits = defineEmits(["next"]);
const gameData = ref([]);

const next = (item:Object) =>{
  emits("next", item);
}

const getData = async () => {
  const res = await gameList();
  if (res.status === 0) {
    gameData.value = res.data.goods_info;
    console.log(gameData.value, res, "value");
  }
  console.log(res, "resssss");
};

getData();
</script>

<style scoped lang="scss">
.step1 {
  p {
    color: #0e2e57;
    font-size: 20px;
    font-weight: 600;
  }
  .game-list {
    display: flex;
    flex-wrap: wrap;
    padding: 0 20px;
    .game-item {
      border: 2px solid var(--theme-color);
      box-sizing: border-box;
      padding: 20px 30px;
      border-radius: 5px;
      margin-top: 30px;
      width: 100%;
      .title {
        color: #0e2e57;
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 10px;
      }
      img {
        max-width: 100%;
      }
      .desc {
        margin-top: 10px;
        word-break: break-all;
      }
      .btn {
        margin: 0 auto;
        color: #e2e8fc;
        background: var(--theme-color-btn);
        font-size: 14px;
        width: 50%;
        text-align: center;
        cursor: pointer;
        height: 35px;
        line-height: 35px;
        font-weight: 600;
      }
    }
  }
}
</style>